<?php 
session_start();
$lang = $_REQUEST['lang'];
if (empty($lang) || $lang == "EN") {
	include "../../value/value_en.php";
} else if($lang == "VN") {
	include "../../value/value_vn.php";
}
else {
	include "../../value/value_kr.php";
}
include '../../operations/connection.php';
$id_employee=$_REQUEST['idem'];

mysql_query("UPDATE listapprove SET IDLabel = IDStatus WHERE IDStatus > 10");
mysql_query("UPDATE listapprove SET IDStatus=1 WHERE IDStatus > 10");

$sql="SELECT l.IDLable,l.LableName, 
(SELECT COUNT(*) FROM approvedoc a WHERE a.IDLabel=l.IDLable) as slApprove,
(SELECT COUNT(*) FROM listapprove la,approvedoc a WHERE la.IDLabel=l.IDLable AND a.IDGroupApprove=la.IDGroupApprove AND la.IDEmployee='$id_employee') as slgApprove,
(SELECT COUNT(*) FROM list_reference lr,approvedoc a WHERE lr.IDLabel=l.IDLable AND a.IDGroupApprove=lr.id_group AND lr.id_employee='$id_employee') as slreference
FROM list_lable l WHERE l.IDEmployee='$id_employee';";
	$manglibrary=mysql_query($sql);
?>
												<!-- <li id="luanajax1">
													<span><img src="images/index_25.gif" alt="" /><a href="#" id="luanajax" onclick="onclickajax()">My ajax</a> </span>
												</li> -->
												<?php 
												
													if(count($manglibrary)>0){
														$vitri=1;
														while($row=mysql_fetch_array($manglibrary)){
															?>
															<li>
																<table style="width:100%;border:1;">
																	<tr>
																		<td>
																			<span><img src="images/index_25.gif" alt="" />
																			<a href="library.php?content=list-library-content&liname=<?php echo $row[LableName];?>&libraryid=<?php echo $row[IDLable];?>" ><?php echo $row[LableName]?>
																			<?php 
																				$soluong=$row[slApprove]+$row[slgApprove]+$row[slreference];
																				echo " ( ".$soluong." )";
																			?>
																			</a> </span>
																			<span style="float: right"><a href="#?w=350" onclick="getresult('<?=$row[LableName]?>',<?=$row[IDLable]?>,<?=$soluong?>,this);" rel="popup_name2" class="poplight"><img src="images/cleardot.gif" alt="" /></a></span>
																		</td>
																	</tr>
																</table>
															</li>
															<?php 
														}
													}
												?>
												<?php  mysql_close($connection);?>